<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>若梦TV--登录</title>
	<link rel="icon" href="favicon.ico">
	<link rel="stylesheet" type="text/css" href="../../lib/css/animate.min.css">
	<link rel="stylesheet" type="text/css" href="../../lib/css/jquery.dialogbox.css">
	<link rel="stylesheet" type="text/css" href="../../lib/css/reset.css">
	<link rel="stylesheet" type="text/css" href="../../css/comm.css">
	<link rel="stylesheet" type="text/css" href="../../css/login.css">
	<script type="text/javascript" charset="UTF-8" src="../../lib/js/jquery.min.js"></script>	
	<script type="text/javascript" charset="UTF-8" src="../../lib/js/reg.js"></script>
	<script type="text/javascript" charset="UTF-8" src="../../lib/js/md5.js"></script>
</head>
<body>
	<div class="login-wrap">
		<div class="login-logo" onclick="location.href='../view/index.html';"></div>
		<div class="login-inner">
			<div class="login-line full-line"><div class="left"><img src="../../img/login_phone.png" alt=""></div><input type="text" placeholder="手机号码" name="phone" autocomplete="off"></div>
			<!-- <div class="login-line no-border">
				<div class="line-left left">
					<div class="left"><img src="../../img/login_fw.png" alt=""></div>
					<input type="text" placeholder="图片验证码" name="imgVerifiCode" autocomplete="off">
				</div>
				<div class="line-right right imgVerifiCode"><img src="/Captcha.jpg" alt=""></div>
			</div> -->
			<div class="login-line full-line"><div class="left"><img src="../../img/login_fw.png" alt=""></div><input type="password" placeholder="密码" name="password" autocomplete="off"><div class="login-fw"><a href="login_fw.html">忘记密码？</a></div></div>
			<div class="login-line no-border"><div class="login-btn text-center btn">登录</div></div>
		<!-- 	<div class="login-last"><div class="left"><a href="login_code.html">验证码登录</a></div> -->
		<div class="right">还没有账号？<a href="regsiter.html">注册</a></div></div>
		</div>
		
		<!-- 加载层 -->
		<div class="fakeloader"></div>
</body>

<script type="text/javascript" charset="UTF-8" src="../../lib/js/fakeloader.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="../../layui/lay/dest/layui.all.js"></script>
<script type="text/javascript" charset="UTF-8" src="../../js/main.js"></script>
<script type="text/javascript" charset="UTF-8" src="../../lib/js/jquery.hDialog.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="../../js/login.js"></script>
<script type="text/javascript">

$(document).on('click','.imgVerifiCode',function(){
	$(this).find('img').attr('src','/Captcha.jpg?code=' + Math.random())
});

//登录按钮登录
$(document).on('click','.login-btn',function(){
	checkLogin();
})
//回车键登录
document.onkeydown = function(e){
		var ev = document.all ? window.event : e;
		if(ev.keyCode==13) {
			checkLogin();
		}
	};

	function checkLogin() {
		var info = {
				mobile : $('input[name=phone]').val(),
				imgVerifiCode : $('input[name=imgVerifiCode]').val(),
				password : $('input[name=password]').val()		
			};
			if (info.mobile.length == 0) {
				return $.tooltip('手机号码不能为空')
			}else if(!checkPhone(info.mobile)){
				return $.tooltip('手机号码只能为11位且不为0开头的数字的组合')
			}
			/* if (info.imgVerifiCode.length == 0) {
				return $.tooltip('验证码不能为空')
			}else if (!checkcode(info.imgVerifiCode)) {
				return $.tooltip('验证码只能为4位数字的组合')
			} */
			if (info.password.length == 0) {
				return $.tooltip('密码不能为空')
			}else if (!checkPw(info.password)) {
				return $.tooltip('密码长度为6-16位')
			}
			console.log(info.password);
			info.password = $.md5(info.password);
			ajax_login (info);
	}
</script>
</html>